<template>
	<view>
		<view class="movie-top">
			<view class="top-region" @click="getShow(cityInfo.city)">
				<text v-if="cityInfo.city">{{cityInfo.city}}</text>
				<text v-else>北京市</text>
				<image src="../../static/imgs/go-icons.png"></image>
			</view>
			<view class="movie-top-right" @click="SearchHandel()">
				<image src="../../static/imgs/icon-search.png" class="sechut"></image>
				<text>搜影片、影院、演员</text>
			</view>
			<view>
				<image class="movie-top-right2" src="../../static/imgs/扫一扫_24.png"></image>
			</view>
		</view>
		<view class="top-tab-list">
			<view class="tab-list-items" @click="gettab(value.type,index)" :class="{'sel-item':value.type==tanIndex}"
				v-for="(value,index) in tabLists" :key="index">
				{{value.text}}
				<view class="cut-img" v-if="tanIndex==value.type"></view>
			</view>
		</view>
		<view class="movie-main" v-if="tanIndex==1">
			<view class="<strong>uni-margin-wrap</strong>">
				<swiper class="swiper" circular autoplay indicator-dots indicator-color="#fff"
					indicator-active-color="#ff9934">
					<swiper-item v-for="(item,index) in imageList">
						<image :src="item.src" style="width: 100%;"></image>
					</swiper-item>
				</swiper>
			</view>
			<view class="movie-list" v-for="(value,index) in dataList" :key="index" @click="getUrl(value)">
				<view class="movie-img">
					<image :src="value.posterUrl"></image>
				</view>
				<view class="movie-info">
					<view class="mo-info-top">
						<view class="tiel">{{value.movieName}}</view>
						<view class="movie-d"><text class="zimu">IMAX</text><text class="shuzi">2D</text></view>
					</view>
					<view class="rate-item">
						<u-rate readonly :count="5" v-model="value.grade" active-color="#fd673a" indicator-active-color="#FF6E06"
							:size="30"></u-rate>
						<!-- <text class="rate-nun">{{value.grade}}</text> -->
					</view>
					<view class="director">导演：{{value.director}}</view>
					<view class="to-star">主演：{{value.cast}}</view>

					<view class="calss-item">
						<view class="classify-item">{{value.duration}}分钟</view>
					</view>
				</view>
				<view class="movie-btns" >购票</view>
			</view>
		</view>

        <view class="movie-main" v-if="tanIndex==2">
			55555
		</view>

	</view>
</template>

<script>
	// import {filmList,getCity} from "@/api/film.js"

	import config from "@/utils/configs.js"
	export default {
		
		data() {
			return {
				// 电影首页
				tabLists: [{
						text: '热映',
						type: 1,
						isLoad: false,
						list: []
					},
					{
						text: '影院',
						type: 2,
						isLoad: false,
						list: []
					},
					{
						text: '即将上映',
						type: 3,
						isLoad: false,
						list: []
					},
					{
						text: '在线看',
						type: 4,
						isLoad: false,
						list: []
					},
				],
				tanIndex: 1,
				rateValue: 3,
				dataList: [{
						posterUrl: "https://gw.alicdn.com/i1/O1CN01sSmj2b1daSm6IAUcs_!!6000000003752-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "长津湖之水门桥",
						grade: "2",
						cast: "吴京 易烊千玺 段奕宏 张涵予 朱亚文 李晨 韩东君 耿乐 杜淳",
						director: "徐克",
						duration: 149,
						publishDate: "2022-02-01 08:00:00",
						like: 1155844,
						movieType: "剧情|历史|战争"
					},
					{
						posterUrl: "https://gw.alicdn.com/i1/O1CN013Ggc2s1Z8HwrwxAfn_!!6000000003149-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "奇迹·笨小孩",
						grade: "4",
						cast: "易烊千玺 田雨 陈哈琳 齐溪 公磊 许君聪 王宁 黄尧 巩金国",
						director: "文牧野",
						duration: 106,
						publishDate: "2022-02-01 08:00:00",
						like: 686060,
						movieType: "剧情"
					}, {
						posterUrl: "https://gw.alicdn.com/i1/O1CN01sSmj2b1daSm6IAUcs_!!6000000003752-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "长津湖之水门桥",
						grade: "9.6",
						cast: "吴京 易烊千玺 段奕宏 张涵予 朱亚文 李晨 韩东君 耿乐 杜淳",
						director: "徐克",
						duration: 149,
						publishDate: "2022-02-01 08:00:00",
						like: 1155844,
						movieType: "剧情|历史|战争"
					},
					{
						posterUrl: "https://gw.alicdn.com/i1/O1CN013Ggc2s1Z8HwrwxAfn_!!6000000003149-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "奇迹·笨小孩",
						grade: "9.6",
						cast: "易烊千玺 田雨 陈哈琳 齐溪 公磊 许君聪 王宁 黄尧 巩金国",
						director: "文牧野",
						duration: 106,
						publishDate: "2022-02-01 08:00:00",
						like: 686060,
						movieType: "剧情"
					},
					{
						posterUrl: "https://gw.alicdn.com/i1/O1CN01sSmj2b1daSm6IAUcs_!!6000000003752-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "长津湖之水门桥",
						grade: "9.6",
						cast: "吴京 易烊千玺 段奕宏 张涵予 朱亚文 李晨 韩东君 耿乐 杜淳",
						director: "徐克",
						duration: 149,
						publishDate: "2022-02-01 08:00:00",
						like: 1155844,
						movieType: "剧情|历史|战争"
					},
					{
						posterUrl: "https://gw.alicdn.com/i1/O1CN013Ggc2s1Z8HwrwxAfn_!!6000000003149-0-alipicbeacon.jpg_480x480Q30s150.jpg",
						movieName: "奇迹·笨小孩",
						grade: "9.6",
						cast: "易烊千玺 田雨 陈哈琳 齐溪 公磊 许君聪 王宁 黄尧 巩金国",
						director: "文牧野",
						duration: 106,
						publishDate: "2022-02-01 08:00:00",
						like: 686060,
						movieType: "剧情"
					},
				],
				index: 0,
				show: false,
				cityList: [],
				keyWord: '',
				cityShowList: [],
				isLoad: false,
				cityInfo: {
					city: '北京'
				},
				wellList: [], //所有热映数据
				soonList: [], //所有即将上映数据
				page: 1,
				// 轮播图
				imageList: [{
						src: "https://n.sinaimg.cn/sinacn20120/191/w1080h1511/20190420/70d6-hvvuiyn3610833.jpg"
					},
					{
						src: "https://p9.itc.cn/images01/20211210/31c8c9c82f884ac384e846dba8af675d.jpeg"
					},
					{
						src: "https://news.youth.cn/jsxw/201701/W020170131682901548334.jpg"
					},
					{
						src: "https://p2.cri.cn/M00/77/DA/CqgNOl2cAoyABT8iAAAAAAAAAAA690.1000x562.jpg"
					},
					{
						src: "https://img1.baidu.com/it/u=1036535075,3810287780&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=722"
					}
				],
			}
		},
		onLoad(city) {
			this.cityInfo.city = city.citys
		},
		onShow() {
			console.log('App Show555555')
			console.log(JSON.stringify($route),"ddddd");
		},

		onReachBottom() {
			// this.page++
			// if(this.tanIndex==1){
			// 	this.dataList = this.dataList.concat(config.pageDataFn(this.page,8,this.wellList))
			// }else{
			// 	this.dataList = this.dataList.concat(config.pageDataFn(this.page,8,this.soonList))
			// }
		},
		methods: {
			
			//跳转到电影院列表
			getUrl(data) {
				if (this.cityInfo.city == '定位中') {
					this.$toast("请选择位置信息")
					return false
				}
				let info = {
					position: this.cityInfo,
					info: data
				}
				console.log(info)
				uni.navigateTo({
					url: '/pages/movie/cinema-list',
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('filmDataFromOpene', {
							data: info
						})
					}
				})
			},
			gettab(type, index) {
				this.index = index
				if (this.tanIndex != type) {
					this.tanIndex = type
					console.log(type)
				}
			},
			getShow(city) {
				uni.navigateTo({
					url: `/pages/FilmModule/citys/citys?citys=${this.cityInfo.city}`
				})
			},
			SearchHandel() {
				uni.navigateTo({
					url: `/pages/FilmModule/Search`
				})
			}
		}
	}
</script>

<style lang="less">
	
	page {
		background-color: #F4F5F7;
		padding-bottom: 120rpx;
	}

	.movie-top,
	.top-tab-list {
		display: flex;
		align-items: center;
		position: fixed;
		top: 0rpx;
		left: 0;
		right: 0;
		background-color: #FFFFFF;
		padding: 30rpx 32rpx;
		z-index: 9999;

	}

	.movie-top-right {
		margin-left: 20rpx;
		padding-left: 2%;
		background-color: #f5f5f5;
		color: #636775;
		font-size: 28rpx;
		width: 67%;
		display: flex;
		border-radius: 28rpx;
		align-items: center;
		height: 56rpx;
		margin-right: 30rpx;
	}

	.movie-top-right2 {
		width: 60rpx;
		height: 60rpx;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;

		.swiper {
			height: 400rpx !important;

			.swiper-item {
				display: block;
				height: 350rpx;
				line-height: 350rpx;
				text-align: center;
			}
		}
	}



	.top-region {
		display: flex;
		align-items: center;
		min-width: 130rpx;
		max-width: 200rpx;

		text {
			color: #636775;
			font-size: 28rpx;
		}

		image {
			width: 24rpx;
			height: 24rpx;
			margin-left: 8rpx;
		}
	}

	.top-tab-list {
		top: -15rpx;
		margin-top: 143rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;

		.tab-list-items {
			color: #636775;
			font-size: 28rpx;
			padding: 0rpx 25rpx;
			position: relative;
		}

		.sel-item {
			color: #2D3039 !important;
			font-size: 32rpx !important;
			font-weight: 600;
		}

		.cut-img {
			width: 52rpx;
			height: 8rpx;
			position: absolute;
			bottom: -30rpx;
			right: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			background-color: #FE602B;
		}
	}

	.sechut {
		width: 35rpx;
		height: 35rpx;
		margin-right: 23rpx;
	}

	.movie-main {
		margin-top: 240rpx;
	}

	.movie-list {
		margin: 20rpx 25rpx 0rpx 25rpx;
		background-color: #FFFFFF;
		border-radius: 20rpx;
		padding: 28rpx 32rpx;
		display: flex;
		align-items: center;

		.movie-img {
			width: 180rpx;
			height: 248rpx;

			image {
				width: 180rpx;
				height: 248rpx;
				border-radius: 20rpx;
			}

		}

		.movie-info {
			margin-left: 24rpx;
			width: 50%;

			.mo-info-top {
				display: flex;
				align-items: center;

				.tiel {
					color: #2D3039;
					font-size: 32rpx;
					font-weight: 600;
				}

				.movie-d {
					margin-left: 20rpx;
					border-radius: 6rpx;
					border: 1rpx solid #C4C4C4;
					color: #A6A8AE;
					font-size: 17rpx;

					.zimu {
						padding: 2rpx 6rpx;
					}

					.shuzi {
						background-color: #C4C4C4;
						padding: 0rpx 6rpx;
						color: #FFFFFF;
					}
				}
			}
		}
	}

	.rate-item {
		display: flex;
		align-items: center;
		margin-top: 16rpx;

		.rate-nun {
			color: #FF6E06;
			font-size: 28rpx;
			font-weight: 550;
			// margin-left: -260rpx;
		}

	}

	.director {
		color: #636775;
		font-size: 24rpx;
		margin-top: 16rpx;
	}

	.to-star {
		color: #787A82;
		font-size: 24rpx;
		margin-top: 10rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.calss-item {
		display: flex;
		align-items: center;
		margin-top: 12rpx;

		.classify-item {
			padding: 6rpx 12rpx;
			border-radius: 6rpx;
			border: 2rpx solid #DADCE4;
			color: #A6A8AE;
			font-size: 20rpx;
		}
	}

	.movie-btns {
		margin-left: auto;
		width: 110rpx;
		height: 58rpx;
		background: linear-gradient(207deg, #FF9272 0%, #FC5421 100%);
		border-radius: 29rpx;
		text-align: center;
		line-height: 58rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		font-weight: 550;
	}

	.region-top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx 20rpx;

		.region-left {
			width: 75%;
			border-radius: 40rpx;
			height: 68rpx;
			background-color: #F5F6F8;
			display: flex;
			align-items: center;
			padding-left: 30rpx;
		}

		.region-val {
			width: 90%;
			font-size: 30rpx;
		}

		.region-btn {
			background: linear-gradient(207deg, #FF9272 0%, #FC5421 100%);
			border-radius: 50rpx;
			height: 68rpx;
			text-align: center;
			width: 140rpx;
			line-height: 68rpx;
			color: #FFFFFF;
			font-size: 24rpx;
			font-weight: 550;
		}
	}

	.region-list {
		padding: 22rpx 35rpx;
		color: #2D3039;
		font-size: 32rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 2rpx solid #E2E2E2;
	}

	.empty {
		text-align: center;
		padding-top: 30rpx;
		color: #787A82;
		font-size: 24rpx;
	}
</style>